<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*
 * Date: 01.12.11
 * Time: 12:26
 */
class Login extends CI_Controller {

    var $user_info;

    public function __construct()
    {
        parent::__construct();
        $this->load->library('session');
        $this->load->helper('url');
        $this->load->model('user', '', TRUE);
        $this->user_info = $this->session->userdata('user_info');        
    }
    
    public function index()
    {
        if($this->user->auth(array('login'=>$this->input->post('login'), 'password'=>$this->input->post('password')))){
            $data_session['login'] = $this->input->post('login');
            $this->session->set_userdata('user_info', $data_session);
        }
        else{
            $this->session->set_flashdata('user_msg', '1');
        }
        redirect(base_url('index.php/main'), 'refresh');
    }
}

/* End of file login.php */